
//
// 110228 - AH - Created.
// 110423 - AH - No more direct access to ontology on SoekratEngine, must
//               use getWheel() first to get.
//

package org.soekrat.gui.swing.studio;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JPopupMenu;

import org.soekrat.engine.Soekrat2Engine;
import org.soekrat.swing.network.NetworkTableView;

/**
 * <p>
 *   {@link RatStudioView} to show 
 *   {@link NetworkTableView} in a dockable way.
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC)
 */
@SuppressWarnings("serial")
public final class SimpleNetworkRatStudioView extends RatStudioView 
{
  private final NetworkTableView m_ntv;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param engine {@link Soekrat2Engine}.
   */
  public SimpleNetworkRatStudioView(Soekrat2Engine engine)
  {
    super("Network", engine);  
    
    if (engine==null)
    {
      throw new NullPointerException("engine");
    }
    
    m_ntv=new NetworkTableView();
    m_ntv.setNetwork(engine.getWheel().getNetwork());
        
    JPanel panel=getContentPanel();
    
    panel.setLayout(new BorderLayout());
    panel.add(m_ntv, BorderLayout.CENTER);
    
    JPopupMenu pm=getPopupMenu();
    m_ntv.setPopupMenu(pm);
  }
 
}
